#pragma once
#include "..\Core\System.h"
#include "Application.h"
#include <map>

namespace GUIToolkit
{
	class Timer
	{
	private:
		UINT elapse;
		UINT iTimerID;

		static map<UINT, Timer*> timers;
		static void CALLBACK TimerProc ( HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime);

	protected:
		virtual void OnTick()
		{
			this->Tick(NULL);
		}

	public:
		Timer(void);

		UINT GetElapse() const { return this->elapse; }

		event Tick;

		bool IsRunning() { return iTimerID; }

		void Start(UINT elapse);

		void Stop();

		~Timer(void);
	};
}